<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrderSamplesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_samples', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('order_id')->default('0')->comment('订单');
            $table->integer('item_id')->default('0')->comment('检测项目');
            $table->integer('qrcode_id')->default('0')->nullable()->comment('二维码');
            $table->integer('is_used')->default('0')->nullable()->comment('是否被使用');
            $table->integer('status')->default('0')->nullable()->comment('状态');
            $table->integer('binder_id')->default('0')->nullable()->comment('绑定人');
            $table->dateTime('bind_time')->nullable()->comment('绑定时间');
            $table->string('sample_sn')->nullable()->comment('样本编码');
            $table->integer('test_location_id')->default('0')->nullable()->comment('检测地点');
            $table->integer('checker_id')->default('0')->nullable()->comment('检测人');
            $table->string('name')->nullable()->comment('姓名');
            $table->integer('gender')->default('0')->nullable()->comment('性别');
            $table->integer('age')->default('0')->nullable()->comment('年龄');
            $table->integer('relationship_type')->default('0')->nullable()->comment('身份');
            $table->string('contact')->nullable()->comment('联系方式');
            $table->string('id_card')->nullable()->comment('身份证');
            $table->dateTime('test_time')->nullable()->comment('检测时间');
            $table->mediumText('check_result')->nullable()->comment('检测结果');
            $table->integer('check_pdf_id')->default('0')->nullable()->comment('PDF');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_samples');
    }
}
